execute as @e[type=item_frame,nbt={Tags:["battery_recharger"]}] at @s unless block ~ ~-1 ~ white_glazed_terracotta unless block ~ ~-1 ~ red_glazed_terracotta unless block ~ ~-1 ~ green_glazed_terracotta run function advm:machines/battery_recharger_giveback
execute as @e[type=item_frame,nbt={Tags:["battery_recharger"]}] at @s if entity @e[distance=..1.5,type=item_frame,nbt={Tags:["wire"]},tag=hasPower] as @s[nbt={Item:{tag:{chargeable:1b}}}] run function advm:machines/battery_recharger_recharge
execute as @e[type=item_frame,nbt={Tags:["battery_recharger"]}] at @s unless entity @e[distance=..1.5,type=item_frame,nbt={Tags:["wire"]},tag=hasPower] run setblock ~ ~-1 ~ white_glazed_terracotta replace
execute as @e[type=item_frame,nbt={Tags:["battery_recharger"]}] at @s unless data entity @s Item.tag.battery run setblock ~ ~-1 ~ white_glazed_terracotta replace
